macromedia Your Account International Help
Products Support & Training DevNet Solutions Partners Downloads Store
Products Support & Training DevNet Solutions Partners Downloads Store
Home > Products > Dreamweaver > Support > TechNote Index
Macromedia Dreamweaver Support Center - TechNote

Compilation error when using the ASP.NET Page Load object

Issue
Using the ASP.NET VB development model, users running a page that uses an ASP.NET Page Load object will encounter the following error:

Compilation Error

Description: An error occurred during the compilation 
of a resource required to service this request. Please 
review the following specific error details and modify 
your source code appropriately.


Compiler Error Message: BC30037: Character is not valid.

Reason
The code generated by Dreamweaver MX contains a semicolon and is missing a line break, both of which makes it invalid. The following code is produced (the problem semicolon is highlighted in red):

<script runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
If Not IsPostBack Then DataBind();
End If
End Sub
</script>
Note: This is not an issue for developers working with an ASP.NET C # server model.

Solution
Two solutions are provided. The first will assist you in fixing existing instances of code. The second will instruct you in changing the source file that generates the code so that you can avoid getting the invalid code. All users should follow the second set of instructions, but users who wish to fix existing instances of code should also follow the first set of instructions.

Solution 1: Change existing instances of code

1 Open any pages that use this code already.
2 Locate the script code in Code view (View > Code).
  Note: Users may wish to search for instances of Page_Load by choosing Edit > Find and Replace, then searching for Source Code of Page_Load. Click Find Next.
3 Within the code, remove the semicolon and input a line break after the "Then" statement. The completed code looks like the following:
 
<script runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
If Not IsPostBack Then 
  DataBind()
End If
End Sub
</script>

Solution 2: Change the source file that generates the malformed code

 
1 Locate the Page_Load.htm file. This file is located in the Configuration folder of the location of the Dreamweaver MX installation.
 
> Default Windows location
c:\program files\macromedia\dreamweaver mx\configuration\objects\ ASP.NET\
> Default Macintosh location
Mac HD: Applications: Macromedia Dreamweaver MX: Configuration: Objects: ASP.NET:
  Note: As with any change to application files, users should make a backup copy of the file prior to editing the file.
2 With Dreamweaver MX closed, open Page_Load.htm file in a text editor and look for the following lines of code (the code in red is the code that must be changed):
 
else if (docType == 'ASP.NET_VB')
{
    before = '<' + 'script runat="server">\nSub
Page_Load(Src As Object, E As EventArgs)\nIf Not 
IsPostBack Then DataBind();\nEnd If';
    after = '\nEnd Sub\n</' + 'script>';
}
3 Change the code so that it looks like the following code. The code in red is what must be changed:
 
else if (docType == 'ASP.NET_VB')
{
    before = '<' + 'script runat="server">\nSub 
Page_Load(Src As Object, E As EventArgs)\nIf Not 
IsPostBack Then\nDataBind()\nEnd If'; 
    after = '\nEnd Sub\n</' + 'script>';
}
4 Save the Page_Load.htm file and restart Dreamweaver MX.


ID: 18609
Product: Dreamweaver
Versions: MX, 6.1
OS: Windows-All, Mac-All
Browser: All
Server: MS IIS or Peer Web Server
Database: All
Former ID:  
How useful was this document?
less more

1

2

3

4

5

How can the document be improved? (300 characters or less - you will not receive a reply.)

Last updated: April 8, 2003
Created: April 22, 2003